# -*- coding: utf-8 -*-
import emoji
import datetime


from django.db import models
# timezone 用于处理时间相关事务。
from django.utils import timezone
# from mptt.models import MPTTModel, TreeForeignKey
from django.contrib.auth.models import User


class TeachingArrangement(models.Model):
    """
    功能说明：安阳理论教学安排表
    --------------------------------------------------------------------
    修改人        修改时间        修改原因
    --------------------------------------------------------------------
    张凯         2020-09-10
    --------------------------------------------------------------------
    """
    semester = models.CharField(u"学期", default="", max_length=70)
    type = models.IntegerField(u"类型", default=1)
    department = models.CharField(u"部门", default="", max_length=80)
    teacher_name = models.CharField(u"教师姓名", default="", max_length=80)
    position = models.CharField(u"职位", default="", max_length=70)
    course = models.CharField(u"课程", default="", max_length=90)
    credit = models.FloatField(u"学分", default=0)
    all_period = models.IntegerField(u"总学时", default=0)
    teach_period = models.IntegerField(u"讲授学时", default=0)
    test_period = models.IntegerField(u"实验学时", default=0)
    practice_period = models.IntegerField(u"实践学时", default=0)
    other_period = models.IntegerField(u"其它学时", default=0)
    class_no = models.CharField(u"上课班号", default="", max_length=20)
    class_num = models.IntegerField(u"上课人数", default=0)
    evaluation_mode = models.CharField(u"考核方式", default="", max_length=20)
    class_sort = models.CharField(u"课程类别", default="", max_length=20)
    class_institution = models.CharField(u"上课班级机构", default="", max_length=70)
    week = models.CharField(u"周次", default="", max_length=20)
    single_double_week = models.CharField(u"单双周", default="", max_length=20)
    section = models.CharField(u"节次", default="", max_length=40)
    site = models.CharField(u"地点", default="", max_length=40)
    add_time = models.IntegerField(u"创建时间", default=0)
    update_time = models.IntegerField(u"更新时间", default=0)

    class Meta:
        db_table = 'teaching_arrangement'



class ExpArrangement(models.Model):
    """
    功能说明：安阳实验教学安排表
    --------------------------------------------------------------------
    修改人        修改时间        修改原因
    --------------------------------------------------------------------
    张凯         2020-09-10
    --------------------------------------------------------------------
    """
    semester = models.CharField(u"学期", default="", max_length=70)
    type = models.IntegerField(u"类型", default=2)
    department = models.CharField(u"部门", default="", max_length=80)
    teacher_name = models.CharField(u"教师姓名", default="", max_length=80)
    position = models.CharField(u"职位", default="", max_length=70)
    course = models.CharField(u"课程", default="", max_length=90)
    period = models.IntegerField(u"学时", default=0)
    class_no = models.CharField(u"上课班号", default="", max_length=20)
    class_num = models.IntegerField(u"班级人数", default=0)
    exp_project = models.CharField(u"实验项目", default="", max_length=200)
    exp_class = models.CharField(u"实验班级", default="", max_length=30)
    exp_num = models.IntegerField(u"实验人数", default=0)
    section = models.CharField(u"节次", default="", max_length=40)
    site = models.CharField(u"地点", default="", max_length=200)
    add_time = models.IntegerField(u"创建时间", default=0)
    update_time = models.IntegerField(u"更新时间", default=0)

    class Meta:
        db_table = 'exp_arrangement'


class PracticeArrangement(models.Model):
    """
    功能说明：安阳实践教学安排表
    --------------------------------------------------------------------
    修改人        修改时间        修改原因
    --------------------------------------------------------------------
    张凯         2020-09-10
    --------------------------------------------------------------------
    """
    semester = models.CharField(u"学期", default="", max_length=70)
    type = models.IntegerField(u"类型", default=3)
    department = models.CharField(u"部门", default="", max_length=80)
    teacher_name = models.CharField(u"教师姓名", default="", max_length=80)
    course = models.CharField(u"课程", default="", max_length=90)
    sort = models.CharField(u"实验类别", default="", max_length=40)
    credit = models.FloatField(u"学分", default=0)
    period = models.IntegerField(u"学时", default=0)
    week_num = models.IntegerField(u"周数", default=0)
    week_time = models.CharField(u"周次", default="", max_length=30)
    class_institution = models.CharField(u"地点", default="", max_length=200)
    site = models.CharField(u"地点", default="", max_length=200)
    add_time = models.IntegerField(u"创建时间", default=0)
    update_time = models.IntegerField(u"更新时间", default=0)

    class Meta:
        db_table = 'practice_arrangement'


class Subject(models.Model):
    """
    功能说明：安阳教学 题库表
    --------------------------------------------------------------------
    修改人        修改时间        修改原因
    --------------------------------------------------------------------
    张凯         2020-09-10
    --------------------------------------------------------------------
    """
    quesion = models.TextField(u"题干", default="")
    source_value = models.FloatField(u"分值", default=0)
    type = models.IntegerField(u"题库类型", default=0)   # 1理论 2 实验 3 实践 4体育 5艺术技法 6外语课 7艺术理论
    add_time = models.IntegerField(u"创建时间", default=0)
    update_time = models.IntegerField(u"更新时间", default=0)

    class Meta:
        db_table = 'subject'



class MarkResult(models.Model):
    """
    功能说明：督导老师打分结果
    --------------------------------------------------------------------
    修改人        修改时间        修改原因
    --------------------------------------------------------------------
    张凯         2020-09-10
    --------------------------------------------------------------------
    """
    arrange_id = models.IntegerField(u"排课id", default=0)
    teacher_name = models.CharField(u"教师姓名", default="", max_length=50)
    supervisor_name = models.CharField(u"督导教师姓名", default="", max_length=50)
    department_name = models.CharField(u"学院名称", default="", max_length=60)
    type = models.IntegerField(u"类型", default=0)                    # 1理论 2 实验 3 实践 4体育 5艺术技法 6外语课 7艺术理论
    user_id = models.IntegerField(u"督导用户id", default=0)
    week_num = models.CharField(u"周次", default="0", max_length=50)
    all_people_num = models.IntegerField(u"应到人数", default=0)
    attendance = models.IntegerField(u"实到人数", default=0)
    evaluate = models.CharField(u"评价", default="", max_length=500)
    remark = models.CharField(u"备注", default="", max_length=500)
    image_url = models.CharField(u"场景图片链接", default="", max_length=255)
    question_result = models.TextField(u"打分详情", default="")  # 打分详情 json: [{"question":"内容", "score":3}]
    gross_score = models.IntegerField(u"总分数", default=0)
    add_time = models.IntegerField(u"创建时间", default=0)
    update_time = models.IntegerField(u"更新时间", default=0)

    class Meta:
        db_table = 'mark_result'


class TeacherData(models.Model):
    """
    功能说明：记录老师每次课程被听课人数
    --------------------------------------------------------------------
    修改人        修改时间        修改原因
    --------------------------------------------------------------------
    张凯         2020-09-10
    --------------------------------------------------------------------
    """
    teacher_name = models.CharField(u"老师姓名", default="", max_length=50)
    arrange_id = models.IntegerField(u"排课id", default=0)
    attend_person_num = models.IntegerField(u"被听课人数", default=0)
    add_time = models.IntegerField(u"创建时间", default=0)
    update_time = models.IntegerField(u"更新时间", default=0)

    class Meta:
        db_table = 'teacher_data'


class CourseAverageScore(models.Model):
    """
    功能说明：记录老师每次课程的平均分
    --------------------------------------------------------------------
    修改人        修改时间        修改原因
    --------------------------------------------------------------------
    张凯         2020-09-10
    --------------------------------------------------------------------
    """
    teacher_name = models.CharField(u"老师姓名", default="", max_length=50)
    arrange_id = models.IntegerField(u"排课id", default=0)
    first_super = models.TextField(u"一级督导打分数", default=[])
    two_super = models.TextField(u"二级督导打分数", default=[])
    type = models.IntegerField(u"课程类型", default=0) # 1理论 2 实验 3 实践 4体育 5艺术技法 6外语课 7艺术理论
    add_time = models.IntegerField(u"创建时间", default=0)
    update_time = models.IntegerField(u"更新时间", default=0)

    class Meta:
        db_table = 'course_average_score'